import React from 'react';
import { INTERVIEW_WAY } from '@/pages/Informal/containers/DiscussArrange/index';

// 可怕的设计
const useInterviewWay = ({ interviewWayName, interviewWay = 0, videoLink, interviewLocation }) => {
    const isVideo = interviewWayName === '视频' || Number(interviewWay) === INTERVIEW_WAY.VIDEO;
    const interviewWayLabel = isVideo ? '会议链接' : '面试地点';
    const detail = isVideo ? videoLink : interviewLocation;
    const field = isVideo ? 'videoLink' : 'interviewLocation';
    const interviewWayDetail =
        isVideo && detail ? (
            <div style={{ textAlign: 'left' }}>
                <a target="_blank" rel="noopener noreferrer" href={detail} style={{ wordBreak: 'break-all' }}>
                    {detail}
                </a>
            </div>
        ) : (
            detail || '--'
        );
    return [interviewWayLabel, interviewWayDetail, field];
};

export default useInterviewWay;
